package com.onstar.cn.api.v3;

import com.onstar.cn.api.framework.BaseApiService;
import com.onstar.cn.api.framework.ClazzInjectUtils;
import com.onstar.cn.api.framework.annotation.Path;
import com.onstar.cn.api.framework.annotation.RequestMapping;
import com.onstar.cn.framework.network.entity.RequestEntity;
import com.onstar.cn.framework.utils.GsonHelper;
import com.onstar.cn.smart.entity.PayChannelRequestEntity;

/**
 * Created by Longmin Li on 2017/7/4.
 * 支付渠道接口
 */
@Path("/msp/api/v3/paymentChannel")
public class PayChannelService extends BaseApiService {
    private String serverURL;

    public PayChannelService(String serverURL) {
        super(serverURL);
        this.serverURL = serverURL;
//        this.serverURL = "http://113.52.176.197:51611";
    }

    /**
     * 获取支付渠道
     *
     * @param requestEntity
     * @param pageNumber
     * @param pageSize
     * @return
     */
    @RequestMapping("/paymentChannelList")
    public RequestEntity getPaymentChannelList(RequestEntity requestEntity, PayChannelRequestEntity channelRequestEntity, String pageNumber,
                                               String pageSize) {
        if (requestEntity == null) {
            requestEntity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(), "getPaymentChannelList", requestEntity, channelRequestEntity, pageNumber, pageSize);
        requestEntity.setUrl(serverURL + url + "?pageNumber=" + pageNumber + "&pageSize=" + pageSize);
        requestEntity.setBody(GsonHelper.toJson(channelRequestEntity));
        return requestEntity;
    }
}
